from numpy import random

# 设定随机数种子
random.seed(1234)

# 产生均匀分布的随机数，维度是 3*2
random.rand(3, 2)
# 输出 array([[0.19151945, 0.62210877],
#        [0.43772774, 0.78535858],
#        [0.77997581, 0.27259261]])

# 产生标准正态分布随机数，维度是3*2
random.randn(3, 2)
# 输出 array([[ 0.85958841, -0.6365235 ],
#        [ 0.01569637, -2.24268495],
#        [ 1.15003572,  0.99194602]])

# 在[0,1）内产生随机数，维度是3*2
random.random((3, 2))
# 输出 array([[0.37025075, 0.56119619],
#        [0.50308317, 0.01376845],
#        [0.77282662, 0.88264119]])

# 产生指定区间的随机整数，维度是3*2
random.randint(low=2, high=10, size=(3, 2))
# 输出 array([[9, 5],
#        [2, 3],
#        [5, 2]])

# 正态分布，loc表示均值，scale表示方差
random.normal(loc=0, scale=1, size=(3, 2))
# 输出 array([[ 0.86371729, -0.12209157],
#        [ 0.12471295, -0.32279481],
#        [ 0.84167471,  2.39096052]])

# 泊松分布
random.poisson(lam=100, size=(3, 2))
# 输出 array([[ 95,  86],
#        [102, 103],
#        [ 93,  99]])

# 均匀分布
random.uniform(low=3, high=10, size=(3, 2))
# 输出 array([[5.67622216, 3.3771158 ],
#        [6.16153886, 9.87403319],
#        [3.8675989 , 3.83566629]])

# 产生beta分布
random.beta(a=3, b=5, size=(3, 2))
# 输出 array([[0.29453428, 0.43079414],
#        [0.74318561, 0.21577619],
#        [0.11941289, 0.44674076]])

# 二项分布（伯努利分布）
random.binomial(n=4, p=0.8, size=(3, 2))
# 输出 array([[3, 2],
#        [4, 3],
#        [3, 3]])

# 指数分布
random.exponential(scale=3, size=(3, 2))
# 输出 array([[ 4.78168574,  2.44771329],
#        [10.12979518,  0.47753906],
#        [ 0.09028607,  2.70341946]])

# F分布
random.f(dfnum=100, dfden=5, size=(3, 2))
# 输出 array([[1.5113714 , 0.77730943],
#        [0.83137741, 0.54722053],
#        [3.7934629 , 5.6308887 ]])
